﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MvcMall.AdminWeb.DtoModels;
using MvcMall.Core.Contacts.Tasks;

namespace MvcMall.AdminWeb.Manage.StoreApplies
{
    public partial class StoreGradesList : ManageBasePage
    {

        private IStoreGradeTask _storeGradeTask;

        protected void Page_Load(object sender, EventArgs e)
        {
            ValidatePagePower("StoreGradesList");
            _storeGradeTask = GetInstance<IStoreGradeTask>();
            if (!IsPostBack)
            {
                Bind();
            }
        }

        protected void Bind()
        {
            rptList.DataSource = _storeGradeTask.GetAll().Select(x => new StoreGradesDto() { Id = x.Id, CanIsBest = x.CanIsBest, CanIsHot = x.CanIsHot, CanPromoted = x.CanPromoted, CanSecKill = x.CanSecKill, CanUploadDefinitionImg = x.CanUploadDefinitionImg, CanUploadVideo = x.CanUploadVideo, GoodsLimit = x.GoodsLimit, GradeDesc = x.GradeDesc, GradeName = x.GradeName, InitiaFee = x.InitiaFee, ManagementFee = x.ManagementFee, SkinLimit = x.SkinLimit, SpaceLimit = x.SpaceLimit });
            rptList.DataBind();
        }

        protected void ANPager_PageChanged(object sender, EventArgs e)
        {
            Bind();
        }
    }
}